package classWork;

import java.util.ArrayList;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;


public class demo7study {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("zhangsan,23");
        list.add("lisi,24");
        list.add("wangwu,25");
        Map<String, Integer> Mapp = list.stream().filter(s -> {
            String[] arr = s.split("\\,");
            int i = Integer.parseInt(arr[1]);
            return i >= 24;
        }).collect(Collectors.toMap(new Function<String, String>() {
            @Override
            public String apply(String s) {
                String[] arr = s.split("\\,");
                return arr[0];
            }
        }, new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                String[] arr = s.split("\\,");
                int i = Integer.parseInt(arr[1]);
                return i;
            }
        }));
        System.out.println(Mapp);


    }

}
